home *** CD-ROM | disk | FTP | other *** search
- MAKEBAR Robert L. Hummel
- Command 1987/No. 10 (Lab Notes)
-
- ______________________________________________________
-
- Purpose: Compiles Lotus-style menus for non-Lotus
- applications programs for use with the
- SLASHBAR.COM utility contained on this disk.
-
- Format: MAKEBAR [path]input_file [path]output_file
-
- Remarks: The input_file must contain the keystrokes
- needed to activate the application program's
- commands, and it must be constructed using
- the .BDF format and syntax illustrated by the
- ASCII-readable DOS.BDF file contained on this
- disk. The output_file produced by MAKEBAR is
- a .BAR file suitable for loading as a pop-up
- window by SLASHBAR. Maximum length of the
- compiled .BAR file is approximately 46,000
- bytes.
-
- Constructing a suitable .BDF file for an
- application is not a trivial undertaking, and
- a thorough study of the original article is
- recommended, if at all possible. The first
- step is to organize the commands needed by
- the application into a menu-tree arrangement
- similar to the DOS menu tree shown below on
- the following page.
-
- The categories in the left column will appear
- on the first line of the first menu screen.
- CLS is immediately run from that screen, so
- it has no lower branches.
-
- |- COPY
- |- FILE --|- DIR
- | |- ERASE
- | |- RENAME
- | |- TYPE
- |
- | |- ASSIGN
- | | |- PARENT
- | |- CHDIR ----|- ROOT
- | | |- OTHER
- | |- FORMAT
- |- DISK --|- LABEL
- | |- MKDIR
- | |- RMDIR
- | |- VOL
- |
- | |- DATE
- |- SYSTEM -|- TIME
- | |- PROMPT
- | |- VER
- |
- |- CLS
-
- The diagram below shows the basic structure of the
- MENU...MEND blocks from which a .BDF file is
- constructed. Again, study the DOS.BDF file on this
- disk.
-
- PROGRAM "NAME" ---------- Identification Name
-
- MENU NAME -----------------------------------|
- OPTION NAME,"HELP LINE" --| |
- COMMANDS -| | |
- . |-- Commands |-- Option |
- . | | Block |
- . -| --| |-- Menu
- OPTION NAME,"HELP LINE" | Block
- COMMANDS |
- . |
- . |
- . |
- MEND ----------------------------------------|
-
- MENU NAME----|
- . | Additional menu
- . |--block(s) as
- . | required
- MEND---------|
-
- END -------- End Of File Indicator
-
- Precede any comments you may wish to include in a .BDF
- menu file with a semicolon. MAKEBAR ignores the
- remainder of any line when it encounters the semicolon
- character. Use the {c}1 key combination to represent
- the semicolon in any names or quoted strings your
- application requires.
-
- Two types of text entries are used in menu files. A
- STRING is an entry surrounded by quotes ("). "DOS 3.1"
- and "JiffyCalc Spreadsheet" are examples of valid
- strings. A string may not contain the quote character,
- but you can use the {c}3 sequence to represent it in a
- string. A NAME is an entry consisting of a single
- word, and must contain no spaces. To aid readability,
- separation characters may be used in names: DO-THIS,
- DO_THAT, DO$IT$NOW, are all valid. Upper/Lower case is
- preserved in strings, but names are capitalized in the
- output file.
-
- Strings may contain any character or key combination
- (except the comment and quote characters) that can be
- recognized by the BIOS. Key combinations in a BDF that
- are not recognized by the BIOS will produce an error
- message. (There may therefore be some commands for a
- given application that cannot be included in the menu
- structure.)
-
- Alpha-numeric keys are entered by typing them. All
- special keys, such as the function keys and shift-key
- combinations are entered in symbolic form as text
- surrounded by braces. The Shift, Ctrl, and Alt keys
- affect only the immediately following key. The
- available special keys and their representation in a
- .BDF file are:
-
- {ESC} Escape {U} Arrow Up
- {TAB} Tab {D} Arrow Down
- {ENTER} ENTER {L} Arrow Left
- {BS} Backspace {R} Arrow Right
- {HOME} Home {INS} Insert
- {PGUP} Page Up {DEL} Delete
- {PGDN} Page Down {C} Control
- {END} End {S} Shift
- {A} Alt
-
- Function Keys
-
- {F1} {F2} {F3} {F4} {F5} {F6} {F7} {F8} {F9} {F10}
-
- Redundant key combinations, such as {S}a instead of A,
- will produce an error message.
-
- Example: To block out a paragraph in WordPerfect the
- sequence would be:
-
- "{A}{F4}{ENTER}"
-
- To enter the WordStar Ctrl-KD sequence (to
- end editing and save changes), you would use
- the string:
-
- "{C}KD"
-
- To replace the current file in 1-2-3, enter:
-
- "/FSR"
-
- A .BDF file always begins with the word PROGRAM,
- followed by a string. The first 10 characters of the
- string are encoded in the compiled .BAR file for
- display in the pop-up window. PROGRAM must be the
- first non-comment line in the program, and it must
- appear only once. Conversely, END causes processing of
- the input file to cease and is the last command read.
- Each .BDF file must include an END.
-
- The remainder of the file consists of MENU-MEND blocks,
- as was diagrammed above. Each block corresponds to one
- complete set of command choices. In the DOS.BDF
- example there are five menu blocks: the top-level
- block; three second level blocks (to represent the
- FILE, DISK, and SYSTEM submenus); and one third level
- block (the CHDIR sub-submenu). Note that the CLS
- option does not require a menu block since that command
- terminates at the first level. The MENU block that
- follows the PROGRAM command is assumed to be the top
- level menu and will be the first one to be executed.
- Subsequent MENU blocks may be in any order.
-
- Each MENU statement takes a NAME as its argument, and
- no two menus can have the same name. The name is used
- as a target when control is transferred between menus
- with the EXECUTE command. Using identical menu names
- will cause MAKEBAR to report a Bad Menu Reference.
-
- The MENU block is divided into one or more OPTION
- blocks. An OPTION block comprises three separate
- parts: name, help line, and commands. While, like a
- menu, each option must have a name, there are no
- restrictions as to uniqueness. The same option name
- may be used in different menus with different meanings,
- though this would not be the best design for a
- consistent interface. Because options may be selected
- by pressing their first letter, if two options begin
- with the same letter, the second option can never be
- executed by pressing that letter. (It can be invoked
- by positioning the cursor and pressing ENTER.) This
- property could be used to prevent accidental use of a
- command by making it more difficult to invoke.
-
- The help string must follow each option name on the
- same line. This string will be displayed below the
- option names when that option is selected with the
- cursor. The length of this string must be less than 78
- characters in order to fit within the window created by
- SLASHBAR. Beginning on the next line, the application
- program commands to be executed when that option is
- chosen are entered. Each command must begin on a
- separate line, and the entire command must be contained
- on that line. If more keys need to be entered than can
- fit on a single line, multiple TYPE statements (see
- below) can be used.
-
- The BDF commands, with their syntax, are listed below:
-
- PROGRAM "string"
- END
- MENU name
- MEND
- OPTION name, "string"
- ASK "string"
- INPUT
- TYPE "string"
- CR
-
- Remember that a name is a single word with no
- separating spaces, and that a "string" is a series of
- characters surrounded by quotes ("). The quotes symbol
- itself cannot be used within a string, but it can be
- represented in a string by the {c}3 sequence.
-
- A number of these commands have been discussed above.
- The five that remain, EXECUTE, ASK, TYPE, INPUT, and
- CR, may only appear inside an OPTION block. These
- commands make up a kind of batch language that controls
- the operation of the SLASHBAR utility. At the end of
- each menu path is a command string that will accomplish
- the desired result when fed to the applications
- program, just as if you typed in the commands directly.
-
- The EXECUTE command transfers control down the menu
- tree. Any option may invoke another menu by executing
- it. Since menu flow is one-way, lines appearing below
- an EXECUTE command within the same OPTION block will
- never be invoked. In addition, since paths in the menu
- tree may not cross, two option blocks cannot execute
- the same menu. MAKEBAR checks for this and signals it
- as an error. This prevents building a circular
- reference into the tree, where a menu could call itself
- indefinitely.
-
- The ASK command is used to prompt the user for
- information. The string argument appears on the screen
- in the upper half of the pop-up window and does not
- affect the output keystrokes. Because the logical use
- of the ASK command is to request a reply, it is usually
- followed by the INPUT command. By using these commands
- together, it is possible to solicit information to
- complete a command sequence.
-
- The INPUT command accepts input from the keyboard and
- appends it to the current command string. The input is
- buffered, and the backspace key can be used to correct
- the entry. Up to 78 characters may be entered, and
- input terminates when the Enter key is pressed. The
- keys are put in the command string as they were typed
- without the terminating <Enter>.
-
- The TYPE command copies the keys in the string argument
- to the command string. Special keys (i.e., function
- keys and shift-key combinations) are stored with a
- special code to indicate that they are extended ASCII.
- A special case of the TYPE command is the CR command.
- It is equivalent to the command
-
- TYPE "{ENTER}"
-
- and is included simply for convenience in closing
- commands after requesting an input.